#!/bin/bash

set -euo pipefail
[ -n "${DEBUG:-}" ] && set -x

export PYTHON="python${TRAVIS_PYTHON_VERSION%.*}"

if [ "${CHECKS}" = "base" ]; then
  docker exec pydoop bash -c \
    "source /etc/profile && cd test && ${PYTHON} all_tests.py"
  docker exec -e PYTHON="${PYTHON}" -e DEBUG="${DEBUG:-}" pydoop bash -c \
    "source /etc/profile && cd examples && ./run_all"
fi

if [ "${CHECKS}" = "extras" ]; then
  docker exec pydoop bash -c \
    "source /etc/profile && cd test/avro && ${PYTHON} all_tests.py"
  docker exec -e PYTHON="${PYTHON}" -e DEBUG="${DEBUG:-}" pydoop bash -c \
    "source /etc/profile && cd examples/avro/py && ./run"
fi
